package com.us.proframe.exception;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 统一异常处理.
 * User: lyh
 * Date: 2017/8/15
 * Time: 16:02
 */
@ControllerAdvice
public class GlobalHandleException {
    private static final Logger LOGGER = LoggerFactory.getLogger(GlobalHandleException.class);


    @ExceptionHandler(Exception.class)
    @ResponseBody
    public Object handleException(Exception e){

        LOGGER.error("this is exception handler!,error info:{}",e);
        return "hello world";
    }
}
